package edu.buct.controller;

import core.api.BaseResponse;
import edu.buct.entity.C2;
import edu.buct.service.C2Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ZYM
 * @since 2023-05-04
 */
@Api(tags = "机房回路2信息")
@RequestMapping("/macroom/c2")
public class C2Controller {
    @Resource
    private C2Service c2Service;

    @ApiOperation("查询机房回路2信息")
    @GetMapping("/all")
    BaseResponse<C2> selectAll(){
        return c2Service.selectAll();
    }

    @ApiOperation("新增机房回路2信息")
    @PostMapping("/insert")
    BaseResponse insert(C2 c2){
        return c2Service.insert(c2);
    }

    @ApiOperation("根据id删除机房回路2信息")
    @ApiImplicitParam(name = "id",value = "气候id",required = true)
    @GetMapping("/remove/{id}")
    BaseResponse delete(@PathVariable("id") Integer id){
        return c2Service.delete(id);
    }

    @ApiOperation("根据id修改机房回路1信息")
    @PostMapping("/update")
    BaseResponse<C2> updateInfo(C2 c2){
        return c2Service.updateInfo(c2);
    }
}
